<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <title>提现</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta name="viewport" content="width=device-width, user-scalable=no">
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta name=”apple-mobile-web-app-status-bar-style” content=”default”/>
    <meta name=”apple-mobile-web-app-status-bar-style” content=”black”/>
    <meta name=”apple-mobile-web-app-status-bar-style” content=”black-translucent”/>
    <meta content="telephone=no" name="format-detection">
    <meta content="email=no" name="format-detection">
    <meta name="format-detection" content="telephone=no"/>
    <link href="${s.base}/mobile/css/weui.min.css" rel="stylesheet"/>
    <link href="${s.base}/mobile/css/jquery-weui.min.css" rel="stylesheet">
    <link href="${s.base}/mobile/css/weReward.css" rel="stylesheet"/>
    <link href="${s.base}/mobile/css/weChat.css" rel="stylesheet"/>
    <script src="${s.base}/mobile/js/fontSize.js" type="text/javascript"></script>
</head>
<body>
<!-- 弹窗提示成功 -->
<div class="tc" style="display: none;">
    <div class="tc-out">
        <div class="tc-ctn">
            <div class="tc-top-pic"><img src="${s.base}/mobile/images/successtip.png"></div>
            <div class="tc-middle-txt">提现成功！</div>
            <div class="tc-bot-btn clearfix">
                <div class="tc-button only-btn-blue">确定</div>
            </div>
        </div>
    </div>
</div>
<!-- 弹窗提示失败 -->
<div class="tc" style="display: none;">
    <div class="tc-out">
        <div class="tc-ctn">
            <div class="tc-top-pic"><img src="${s.base}/mobile/images/failure.png"></div>
            <div class="tc-middle-txt">提现失败！</div>
            <div class="tc-bot-btn clearfix">
                <div class="tc-button only-btn-orange">确定</div>
            </div>
        </div>
    </div>
</div>
<!-- 弹窗确认取消 -->
<div class="tc" style="display: none;">
    <div class="tc-out">
        <div class="tc-ctn">
            <div class="tc-middle-txt"><#if limitDescription !=''>${limitDescription}<#else>暂无说明</#if></div>
        <div class="tc-bot-btn clearfix">
            <div class="tc-button cancel" style="float: right">确定</div>
        </div>
    </div>
</div>
</div>
<div class="amountWith-ctn">
    <h1 id="haveMoney">${haveMoney?string['0.00']}</h1>
    <h2>账户余额（元）</h2>
    <div class="amountWith-bar">
        <div class="div-input-line">
            <div class="item-left"><input type="text" placeholder="请输入金额" id="money" autocomplete="off"></div>
            <div class="item-right" id="allbtn">全部</div>
        </div>
    </div>
    <div class="amountWith-list">
        <div class="div-line-bar">
            <div class="div-line-label">收款账户</div>
            <div class="div-line-hd"><#if account?? && account!=''>${account}<#else>暂无账号</#if></div>
        </div>
        <div class="div-line-bar">
            <div class="div-line-label">限额说明</div>
            <div class="div-line-hd"><span id="showLimitDescription">查看说明</span></div>
        </div>
    </div>
</div>
<div class="bot-tj-btn-70" style="margin-top:1rem;">确认提现</div>
</body>
<script type="text/javascript" src="${s.base}/mobile/js/jquery-2.1.4.min.js"></script>
<script type="text/javascript" src="${s.base}/mobile/js/jquery-weui.js"></script>
<script type="text/javascript" src="${s.base}/mobile/js/common.js"></script>
<script>
    $(function () {
        $("#allbtn").bind("click", function () {
            $("#money").val($("#haveMoney").text());
        });

        $("#showLimitDescription").bind("click", function () {
            $('.tc').eq(2).show();
        });

        $(".tc-button").bind("click", function () {
            if ($(this).hasClass("only-btn-blue")) {
                $('.tc').eq(0).hide();
                window.location.href = "/phone/reward/myReward?token=${token}&applyId=${applyId}";
            } else if ($(this).hasClass("only-btn-orange")) {
                $('.tc').eq(1).hide();
            } else if ($(this).hasClass("cancel")) {
                $('.tc').eq(2).hide();
            }
        });

        $(".bot-tj-btn-70").bind("click", function () {
            var haveMoney = parseFloat('${haveMoney?string["0.00"]}').toFixed(2);
            var money = $("#money").val();
            var account = '${account}';
            if (isBlank(money)) {
                $.toast("请输入金额", "text");
                return false;
            } else {
                if (isNotMoney(money)) {
                    $.toast("提现金额格式不正确", "text");
                    return false;
                }
                if (parseFloat(money).toFixed(2) === parseFloat(0).toFixed(2)) {
                    $.toast("提现金额应大于0", "text");
                    return false;
                }
                if (parseFloat(money).toFixed(2) > haveMoney) {
                    $.toast("提现金额不能大于账户余额", "text");
                    return false;
                }
            }
            if (isBlank(account)) {
                $.toast("收款账户不能为空", "text");
                return false;
            }
            $.fn.doPost('/phone/rewardcashout/addOrUpdate', {applyId: '${applyId}', token: '${token}', money: money, account: account}, function (result) {
                if (result.code === 0) {
                    $('.tc').eq(0).show();
                } else {
                    $('.tc').eq(1).show();
                }
            });
        });
    });
</script>
</html>